extends Node2D


# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta: float) -> void:
	if Input.is_action_just_pressed("跳跃"):
		var node_root = get_tree().current_scene
		print(node_root, "|", node_root.name)
		var node_3 = node_root.find_child("Node2D_3")
		print(node_3, "|", node_3.name)
		var node_3_1 = node_root.find_child("Node2D_3_1")
		print(node_3_1, "|", node_3_1.name)
		node_3_1.queue_free() # 尝试删除节点
	if Input.is_action_just_pressed("左"):
		var node_root = get_tree().current_scene
		var node_3_2 = node_root.find_child("Node2D_3_2")
		var parent = node_3_2.get_parent()
		parent.remove_child(node_3_2)
		var node_1_1 = node_root.find_child("Node2D_1_1")
		node_1_1.add_child(node_3_2)
	if Input.is_action_just_pressed("右"):
		var node_2_1 = Node2D.new()
		node_2_1.name = "Node2D_2_1"
		var node_2 = get_node("/root/Node_Root/Node2D_2")
		node_2.add_child(node_2_1)

	pass
